#ifndef CAR_H
#define CAR_H

#include <QMainWindow>
#include<qpainter.h>
#include<QVector>
#include<QKeyEvent>
#include<QMouseEvent>
#include<qstring.h>
#include<QTimer>

extern int mysw;
QT_BEGIN_NAMESPACE
namespace Ui { class car; }
QT_END_NAMESPACE

class car : public QMainWindow
{
    Q_OBJECT

public:
QRect Creatcar();
QRect Creatcar2();
QRect Creatcar3();
QRect Creatcar4();
QRect Creatcar5();
void ace();
void scorecnt();
void IsEat();
    void IsHit();
//void initvcar();
   explicit car(QWidget *parent = nullptr);
    ~car();
     void paintEvent(QPaintEvent *event);

      //void mousePressEvent(QMouseEvent *event);;
 void keyPressEvent(QKeyEvent *event);
void initcar();

private slots:
    void car_update();//定义槽函数
    void vcar_update();
    void last_update();
    //void on_pushButton_clicked();
    void on_pushButton_clicked();

    void on_lcdNumber_overflow();

    void on_pushButton_3_clicked();



public:
    static int swicher;

public:
    QVector<QRect> vcar1,vcar2,slow,trap,scores,acel;//蛇
private:
bool blsOver;
    Ui::car *ui;
    QRect mycar,test,last1,last2;
    int nDirection,vDirection;
    bool blsRun,blsrun2;//是否开始
    QTimer *timer,*timer2;
   public:
    int speed;
public:
    int judge[100]={0};
    int judge2[100]={0},judge3[100]{0};
    int i,j=1,k=0;
    int count=50,tmp[100]{0},score=0,tmp2[100]{0},standard=50,m=0,tmp4[100]{0},judge5[100]{0};
    int mover=4;int n=1,init=1;
    int b=0;
    int judge4[100]={0};
    int turn=1;int turn2=1;
    int xx=1;
    int display1=0,display2=0;
    int g=1,a=0;
    int tmpp1=0,tmpp2=0,tmpp3=0,tmpp4=0,display5=0,myspeed=4;
    int draw=1;
};






#endif // CAR_H


